import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';

import { ActionSheetController } from 'ionic-angular';
import { AlertController } from 'ionic-angular';

@Component({
  selector: 'page-app-center',
  templateUrl: 'app-center.html'
})
export class AppCenterPage {
  type:string="all"
  wd:any ={
  'name':"wangdan",
  'sex':"female"
  }
  apps:any
  constructor(public navCtrl: NavController, public navParams: NavParams,
  public actionSheetCtrl: ActionSheetController,
  public alertCtrl: AlertController) {
    this.apps  = [
      {"title":"团队管理","icon":"home","color":"danger"},
      {"title":"客户管理","icon":"call","color":"favorite"},
      {"title":"日常管理","icon":"logo-android","color":"secondary"},
      {"title":"现金管理","icon":"logo-usd","color":"twitter"}
    ]

  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad AppCenterPage');
  }
  presentActionSheet() {
      let actionSheet = this.actionSheetCtrl.create({
        title: 'Modify your book',
        buttons: [
          {
            text: 'yes',
            role: 'destructive',
            handler: () => {
              console.log('Destructive clicked');
            }
          },{
            text: 'no',
            handler: () => {
              console.log('Archive clicked');
            }
          },{
            text: 'Cancel',
            role: 'cancel',
            handler: () => {
              console.log('Cancel clicked');
            }
          }
        ]
      });
      actionSheet.present();
    }
    showAlert() {
   let alert = this.alertCtrl.create({
     title: 'New Friend!',
     subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
     buttons: ['OK']
   });
   alert.present();
  }
  showPrompt() {
    let prompt = this.alertCtrl.create({
      title: 'Login',
      message: "Enter a name for this new album you're so keen on adding",
      inputs: [
        {
          name: 'title',
          placeholder: 'Title'
        },
      ],
      buttons: [
        {
          text: 'Cancel',
          handler: data => {
            console.log('Cancel clicked');
          }
        },
        {
          text: 'Save',
          handler: data => {
            console.log('Saved clicked');
          }
        }
      ]
    });
    prompt.present();
  }
}
